{% extends "base.html" %}

{% block title %}
设置
{% endblock %}

{% block content %}
<div style="background:#fff;padding:15px;box-sizing:border-box;">
    <ul class="tabtitle">
        {%for item in base.widget %}
        <li>{{item.title|uw}}</li>
        {%endfor%}
        <li>添加边栏</li>
    </ul>
    {%for item in base.widget %}
    <div class="tabcontent" style="display: none;">
        <form id="formwid{{item.id|uw}}">
            <div class="s_e">
                <strong>标题:</strong>
                <input type="text" class="input_narrow" name="title" value="{{item.title|uw}}" maxlength="15">
            </div>
            <div class="s_h">
                <strong>代码:</strong>（系统标签支持 reply topic class tag）
                <textarea name="html" class="input_textarea">{{item.html|uw}}</textarea>
            </div>
            <div class="s_e">
                <strong>排序:</strong>
                <input type="number" class="input_narrow" name="ord" value="{{item.ord|uw}}" maxlength="15">
            </div>
            <div class="s_s">
                <input type="hidden" name="id" value="{{item.id|uw}}">
                <button name="save" type="button" class="btn" onclick="savewid('{{item.id|uw}}')"> 保存 </button>
                <button name="del" type="button" class="btn" onclick="delwid('{{item.id|uw}}')"> 删除 </button>
                <span id="errmsg"></span>
            </div>
        </form>
    </div>
    {%endfor%}
    <div class="tabcontent" style="display: none;">
        <form id="formwid0">
            <div class="s_e">
                <strong>标题:</strong>
                <input type="text" class="input_narrow" name="title" value="" maxlength="15">
            </div>
            <div class="s_h">
                <strong>代码:</strong>（系统标签支持 reply topic tag class）
                <textarea name="html" class="input_textarea"></textarea>
            </div>
            <div class="s_e">
                <strong>排序:</strong>
                <input type="number" class="input_narrow" name="ord" value="5" maxlength="15">
            </div>
            <div class="s_s">
                <button name="save" type="button" onclick="savewid(0)" class="btn"> 保存 </button> <span
                    id="errmsg"></span>
            </div>
        </form>
    </div>

</div>
{% endblock %}

{% block script %}
<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        $('.tabtitle li:first').addClass('on');
        $('.tabcontent').eq(0).show(200);
        $('.tabtitle li').click(function () {
            var index = $(this).index();
            $(this).addClass('on').siblings('li').removeClass('on');
            $('.tabcontent').eq(index).show(200).siblings('.tabcontent').hide();
        });
    })
</script>
{% endblock %}